﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TTBusiness
{
    /// <summary>
    /// Create by ThiepND 23/3/2011
    /// </summary>
    static class clsBSMD5Password
    {
        public static String ChangeMD5(String strSource)
        {
            try
            {
                System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();

                byte[] bs = System.Text.Encoding.UTF8.GetBytes(strSource);
                bs = x.ComputeHash(bs);
                System.Text.StringBuilder s = new System.Text.StringBuilder();
                foreach (byte b in bs)
                {
                    s.Append(b.ToString("x2").ToLower());
                }
                return s.ToString();
            }
            catch (Exception)
            {

                throw;
            }
        }
        public static String RadomPassword()
        {
            try
            {
                Random r = new Random();
                return r.Next(100000, 999999).ToString();
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
